#include <stdio.h>
#include <string.h>
/* the longest line we will store */
#define MAXLINE 1000
#define MAXPRINTLINE 80

/* print up to the first \n in line */
void
printLine (char * line)
{
  /* position */
  char * p;
  /* find the first occurrence of \n */
  p = strchr (line, '\n');
  /* while line [j] does not pass the first \n,
     putchar (line[j])
  */
  for (int j = 0; &line [j] != (p + 1); j++)
    {
      putchar (line [j]);
    }
}

int
main ()
{
  char c;
  /* store each line here */
  char line [MAXLINE];
  /* loop through every character in the file */
  for (int i = 0; (c = getchar()) != EOF; i++)
    {
      /* store the current character
         into the line array */
      line [i] = c;
      /* if the current char is a newline */
      if (c == '\n')
        {
          /* and the current line is longer than 80 chars */
          if (i > MAXPRINTLINE)
            {
              printLine (line);
            }
          /* set i back to 0 */
          i = -1;
        }
    }
  return 0;
}
